home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / VISCAFE.BIN / VPOJAVA.DLL / SOURCE / ABOUTDIALOG < prev    next >
Encoding:
Text File  |  1997-06-19  |  1.5 KB  |  65 lines

  1. /*
  2.     A basic extension of the java.awt.Dialog class
  3.  */
  4.  
  5. import java.awt.*;
  6.  
  7. public class AboutDialog extends Dialog {
  8.     void okButton_Clicked(Event event) {
  9.         //{{CONNECTION
  10.         // Clicked from okButton Hide the Dialog
  11.         hide();
  12.         //}}
  13.     }
  14.  
  15.     public AboutDialog(Frame parent, boolean modal) {
  16.  
  17.         super(parent, modal);
  18.  
  19.         //{{INIT_CONTROLS
  20.         setLayout(null);
  21.         addNotify();
  22.         resize(insets().left + insets().right + 249,insets().top + insets().bottom + 150);
  23.         label1 = new java.awt.Label("A Basic Java  Application");
  24.         label1.reshape(insets().left + 41,insets().top + 36,166,21);
  25.         add(label1);
  26.         okButton = new java.awt.Button("OK");
  27.         okButton.reshape(insets().left + 93,insets().top + 83,66,27);
  28.         add(okButton);
  29.         setTitle("About");
  30.         setResizable(false);
  31.         //}}
  32.     }
  33.  
  34.     public AboutDialog(Frame parent, String title, boolean modal) {
  35.         this(parent, modal);
  36.         setTitle(title);
  37.     }
  38.  
  39.     public synchronized void show() {
  40.         Rectangle bounds = getParent().bounds();
  41.         Rectangle abounds = bounds();
  42.  
  43.         move(bounds.x + (bounds.width - abounds.width)/ 2,
  44.              bounds.y + (bounds.height - abounds.height)/2);
  45.  
  46.         super.show();
  47.     }
  48.  
  49.     public boolean handleEvent(Event event) {
  50.         if(event.id == Event.WINDOW_DESTROY) {
  51.             hide();
  52.             return true;
  53.         }
  54.         if (event.target == okButton && event.id == Event.ACTION_EVENT) {
  55.             okButton_Clicked(event);
  56.         }
  57.         return super.handleEvent(event);
  58.     }
  59.  
  60.     //{{DECLARE_CONTROLS
  61.     java.awt.Label label1;
  62.     java.awt.Button okButton;
  63.     //}}
  64. }
  65.